Message Methods

object CreateMessage (type: string);

Creates a message object of the specified type. This object can have its properties set to the required values prior to it being sent out to a device via the SendMessage method.

 

Name Type Description
type String The name of the message type to be created

Header CreateHeader();

Messages are sent with a Header object, this object provides data necessary for routing, see the definition of the ‘Header ‘ type);.

Name Type Description
none none none

Return Value – A header object that is initialized to all zero values.

void SendMessage(message: object, header: Header);

This method is to be used to send data to the connected device specified by the Header.

 

Name Type Description
message Object Message created using CreateMessage method
header Header Header created by CreateHeader (or the DeviceID to send this message to)

Example:

var myHeader = CreateHeader(); // Create header structure
var myBody = CreateMessage("TraceRequest"); // Create message structure
myHeader.MessageID = 75;
myHeader.DeviceID = 5;
myHeader.LocationID = 2;
myHeader.DeviceRef = 0;
	
myBody.Barcode = "123456789000"; // Fill the members of the structure
myBody.ActionID = 1;
myBody.OperatorID = 0;
myBody.reserved = 0;
SendMessage(myBody,myHeader); // Send message

myBody.Dispose();   // Release body memory
myHeader.Dispose(); // Release header memory

It is important to use Dispose to release the memory reserved in Messages once they are no longer required as this prevents excessive memory being used over long periods of time.

 

A shortcut is available with SendMessage where it is not necessary to provide a Header, specifying the Device ID number instead. In the example above, the shorter version of SendMessage will become;

SendMessage(myBody,5);

void SetOutputDeviceIO(equipment: object, property: string, value: object);

This method is used to send bitmap data to a connected device. The data configuration must have been set within the DeviceIOs.

 

Name Type Description
equipment Object equipment object, e.g. retrieved by GetComponentByNameAndType()
property String The name of the equipment property to set
value Object The data to apply to the bitmap